﻿using Aragorn.SOA.ORM.DapperExtensions;

namespace Aragorn.SOA.ORM
{
    public class UpdateCommand<T>
    where T : class
    {
        private T model;

        private DbContextData Data
        {
            get;
            set;
        }

        public UpdateCommand(DbContextData contextData, T entity)
        {
            this.Data = contextData;
            this.model = entity;
        }

        public bool Execute()
        {
            return this.Data.Connection.Update<T>(this.model, this.Data, this.Data.Transaction, this.Data.CommandTimeout);
        }
    }
}